package ca.etsmtl.log430.lab3.donnee.beans;


/**
 * This class defines the Course object for the system.
 * 
 * @author A.J. Lattanze, CMU
 * @version 1.4, 2012-Feb-02
 */

/*
 * Modification Log **********************************************************
 * 
 * v1.4, R. Champagne, 2012-Feb-02 - Various refactorings for new lab.
 * 
 * v1.3, R. Champagne, 2011-Feb-02 - Various refactorings, conversion of
 * comments to javadoc format.
 * 
 * v1.2, R. Champagne, 2002-May-21 - Adapted for use at ETS.
 * 
 * v1.1, G.A.Lewis, 01/25/2001 - Bug in second constructor. Removed null
 * assignment to courseID after being assigned a value.
 * 
 * v1.0, A.J. Lattanze, 12/29/99 - Original version.
 * ***************************************************************************
 */
import java.util.ArrayList;
public class CourseBean {

	/**
	 * Course title
	 * @uml.property  name="courseName"
	 */
	private final String courseName;

	/**
	 * Course ID
	 * @uml.property  name="courseID"
	 */
	private final String courseID;

	/**
	 * Course type (course = CRS, laboratory = LAB)
	 * @uml.property  name="type"
	 */
	private final String type;

	/**
	 * Course group
	 * @uml.property  name="group"
	 */
	private final String group;

	/**
	 * Day the course is held on
	 * @uml.property  name="day"
	 */
	private final String day;

	/**
	 * Start time of the course
	 * @uml.property  name="startTime"
	 */
	private  final String startTime;

	/**
	 * Stop time of the course
	 * @uml.property  name="stopTime"
	 */
	private final String stopTime;

	/**
	 * List of teachers assigned to the course
	 * @uml.property  name="teachersAssigned"
	 * @uml.associationEnd  multiplicity="(0 -1)" elementType="java.lang.String"
	 */
	private final ArrayList<String> teachersAssigned;
	
	//private TeacherList teachersAssigned = new TeacherList();
// Constructor

	
	/**
	 * 
	 * @param courseName
	 * @param courseID
	 * @param type
	 * @param group
	 * @param day
	 * @param startTime
	 * @param stopTime
	 * @param teachersAssigned
	 */
	public CourseBean(String courseName, String courseID, String type,
			String group, String day, String startTime, String stopTime,
			ArrayList<String> teachersAssigned) {
		super();
		this.courseName = courseName;
		this.courseID = courseID;
		this.type = type;
		this.group = group;
		this.day = day;
		this.startTime = startTime;
		this.stopTime = stopTime;
		this.teachersAssigned = teachersAssigned;
	}


	/**
	 * Assign a teacher to a class.
	 * 
	 * @param teacher
	 */
	public void assignTeacher(TeacherBean teacher) {
		teachersAssigned.add(teacher.getTeacherID());
	}



	/**
	 * @return
	 * @uml.property  name="courseName"
	 */
	public String getCourseName() {
		return courseName;
	}



	/**
	 * @return
	 * @uml.property  name="courseID"
	 */
	public String getCourseID() {
		return courseID;
	}



	/**
	 * @return
	 * @uml.property  name="group"
	 */
	public String getGroup() {
		return group;
	}


	/**
	 * @return
	 * @uml.property  name="day"
	 */
	public String getDay() {
		return day;
	}



	/**
	 * @return
	 * @uml.property  name="startTime"
	 */
	public String getStartTime() {
		return startTime;
	}


	/**
	 * @return
	 * @uml.property  name="stopTime"
	 */
	public String getStopTime() {
		return stopTime;
	}

	public ArrayList<String> getTeachers() {
		return teachersAssigned;
	}



	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((courseID == null) ? 0 : courseID.hashCode());
		result = prime * result
				+ ((courseName == null) ? 0 : courseName.hashCode());
		result = prime * result + ((group == null) ? 0 : group.hashCode());
		result = prime * result + ((type == null) ? 0 : type.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		CourseBean other = (CourseBean) obj;
		if (courseID == null) {
			if (other.courseID != null)
				return false;
		} else if (!courseID.equals(other.courseID))
			return false;
		if (courseName == null) {
			if (other.courseName != null)
				return false;
		} else if (!courseName.equals(other.courseName))
			return false;
		if (group == null) {
			if (other.group != null)
				return false;
		} else if (!group.equals(other.group))
			return false;
		if (type == null) {
			if (other.type != null)
				return false;
		} else if (!type.equals(other.type))
			return false;
		return true;
	}

	/**
	 * @return
	 * @uml.property  name="type"
	 */
	public String getType() {
		return type;
	}


} // Course class